import { createBrowserRouter } from 'react-router-dom'
import App from '../App'
import Index from '../pages/index/Index';
const router = createBrowserRouter([
    {
        path: '/',
        element: <App />,
    },
    {
        index: true,
        element: <Index></Index>
    },
    {
        path: 'index',
        element: <Index></Index>
    },
    {
        path: '/list',
        lazy: async () => {
            const { default: List } = await import('../pages/list/Index')
            return {
                element: <List></List>
            }
        }
    },
    {
        path: '/login',
        lazy: async () => {
            const { default: Login } = await import('../pages/login/Index')
            return {
                element: <Login></Login>
            }
        }
    },
    {
        path: '/detail',
        lazy: async () => {
            const { default: Detail, loader } = await import('../pages/detail/Index')
            return {
                element: <Detail></Detail>,
                loader
            }
        }
    },
])
export default router;